package azkaban.project.validator;

import azkaban.project.Project;
import azkaban.utils.Props;
import java.io.File;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;

/**
 * ValidatorManager is responsible for loading the list of validators specified in the Azkaban
 * validator configuration file. Once these validators are loaded, the ValidatorManager will use the
 * registered validators to verify each uploaded project before persisting it.
 */
public interface ValidatorManager {

  /**
   * Load the validators using the given properties. Each validator is also given the specified
   * logger to record any necessary message in the Azkaban log file.
   */
  void loadValidators(Props props, Logger logger);

  /**
   * Validate the given project using the registered list of validators. This method returns a map
   * of {@link ValidationReport} with the key being the validator's name and the value being the
   * {@link ValidationReport} generated by that validator.
   */
  Map<String, ValidationReport> validate(Project project, File projectDir, Props props);

  /**
   * Validate the project using one of the specific validator.
   */
  Map<String, ValidationReport> validate(Project project, File projectDir, Props props, String validatorName);


  /**
   * Returns a list of String containing the name of each registered validators.
   */
  List<String> getValidatorsInfo();

  /**
   * Get combined cacheKey for all validators (hash of all hashes)
   */
  String getCacheKey(Project project, File projectDir, Props props);
}
